package it.generali.provajsf;

import it.generali.model.Person;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

@Stateless
public class PersonDao {

	@PersistenceContext
	EntityManager em;
	
	public List<Person> findAll() { 
		
		TypedQuery<Person> query = em.createQuery("select p from Person p", Person.class);
		List<Person> listPerson = query.getResultList();
		return listPerson;
	
	}
	
}
